﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TianShiProject.Models.CarService.Accidents;
using TianShiProject.Models.Common;
using Volo.Abp.Application.Services;

namespace TianShiProject.CarService.Accidents
{
    public class AccidentService : ApplicationService
    {
        private readonly IAccidentRepository _accidentRepository;
        public AccidentService(IAccidentRepository accidentRepository)
        {
            _accidentRepository =accidentRepository;
        }
        /// <summary>
        /// 显示事故记录
        /// </summary>
        /// <param name="name"></param>
        /// <param name="time"></param>
        /// <param name="cardnumber"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public async Task<PageResponse<AccidentDto>> GetShowAccident(string name, DateTime? time, string cardnumber, int pageindex = 1, int pagesize = 3)
        {
            return await _accidentRepository.GetShowAccident(name, time, cardnumber, pageindex, pagesize);
        }
        /// <summary>
        /// 删除违章记录
        /// </summary>
        /// <returns></returns>
        public async Task<int> DeleteDelAccident(int id)
        {
            return await _accidentRepository.DeleteDelAccident(id);
        }
        /// <summary>
        /// 批量删除事故记录
        /// </summary>
        /// <returns></returns>
        public async Task<int> DeleteDelsAccident(string ids)
        {
            return await _accidentRepository.DeleteDelsAccident(ids);
        }
        /// <summary>
        /// 编辑修改
        /// </summary>
        /// <param name="illegalDto"></param>
        /// <returns></returns>
        public async Task<int> PutUpdateAccident(AccidentDto accidentDto)
        {
            return await _accidentRepository.PutUpdateAccident(accidentDto);
        }
        /// <summary>
        /// 添加事故记录
        /// </summary>
        /// <param name="illegalDto"></param>
        /// <returns></returns>
        public async Task<int> PostAddAccident(AccidentDto accidentDto)
        {
            return await _accidentRepository.PostAddAccident(accidentDto);
        }
    }
}
